# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union
from fastapi import Query
from pydantic import BaseModel, Field


class SquareCategoryIn(BaseModel):
    """ 广场分类参数 """
    type: str = Query(default=None, description="分类类型")


class SquareSearchIn(BaseModel):
    """ 广场搜索参数 """
    page_no: int = Query(gt=0, default=1, description="当前页码")
    page_size: int = Query(gt=0, default=15, description="每页条数")
    cate: Union[int, None] = Query(default=None, description="分类ID")
    sort: Union[str, None] = Query(default=None, description="排序类型")
    keyword: Union[str, None] = Query(default=None, max_length=200, description="关键词")


"""--------------- Separator ---------------"""


class SquareSettingVo(BaseModel):
    """ 广场配置Vo """
    type: str = Field(description="广场类型: [robot, draws, video]")
    is_open: int = Field(description="启用状态: [0=否, 1=是]")
    is_user: int = Field(description="用户信息: [0=否, 1=是]")
    name: str = Field(description="广场名称")
    title: str = Field(description="横幅标题")
    banner: str = Field(description="横幅图片")

    class Config:
        json_schema_extra = {
            "example": {
                "type": "robot",
                "is_open": 1,
                "is_user": 1,
                "name": "智能体",
                "title": "海量智能体等您来体验~",
                "banner": "https://www.xxx.cn/images/banner.png"
            }
        }


class SquareCategoryVo(BaseModel):
    """ 广场分类Vo """
    id: int = Field(description="分类ID")
    name: str = Field(description="分类名称")
    icon: str = Field(description="分类图标")

    class Config:
        json_schema_extra = {
            "example": {
                "id": 1,
                "name": "工作学习",
                "logo": "https://www.xxx.cn/images/icon.png"
            }
        }


class SquareRobotVo(BaseModel):
    """ 广场智能体Vo """
    code: str = Field(description="智能体编号")
    name: str = Field(description="智能体名称")
    logo: str = Field(description="智能体图标")
    intro: str = Field(description="智能体简介")
    usage_num: int = Field(description="使用数量")
    collect_num: int = Field(description="收藏数量")
    user: dict = Field(description="用户信息")

    class Config:
        json_schema_extra = {
            "example": {
                "code": "HCxiS50f0d4nd",
                "logo": "https://www.xxx.cn/images/logo.png",
                "name": "智能体名称",
                "intro": "智能体简介",
                "usage_num": 0,
                "collect_num": 0,
                "user": {
                    "sn": "80965941",
                    "nickname": "wait",
                    "avatar": "https://www.xxx.cn/images/avatar.png"
                }
            }
        }


class SquareDrawsVo(BaseModel):
    code: str = Field(description="绘画编号")
    thumbnail: str = Field(description="缩略图片")
    image_loc: str = Field(description="原始图片")
    prompt_in: str = Field(description="输入提示词")
    prompt_en: str = Field(description="英文提示词")
    is_collect: bool = Field(description="是否收藏")
    user: dict = Field(description="用户信息")


class SquareVideoVo(BaseModel):
    code: str = Field(description="视频编号")
    video_url: str = Field(description="视频地址")
    prompt: str = Field(description="视频描述")
    is_collect: bool = Field(description="是否收藏")
    user: dict = Field(description="用户信息")


class SquareMusicVo(BaseModel):
    id: int = Field(description="ID")
    code: str = Field(description="视频编号")
    cover_url: str = Field(description="音乐封面")
    audio_url: str = Field(description="音乐地址")
    title: str = Field(description="音乐名称")
    tags: str = Field(description="音乐风格")
    prompt: str = Field(description="音乐描述")
    lyric: str = Field(description="音乐歌词")
    duration: int = Field(description="音乐时长")
    is_collect: bool = Field(description="是否收藏")
    user: dict = Field(description="用户信息")
